#region File Header
//----------------------------------------------------------------
// Copyright (C) 2002 Stefan Kyntchev
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY 
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT 
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR 
// FITNESS FOR A PARTICULAR PURPOSE.
//----------------------------------------------------------------
#endregion File Header

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Configuration;
using System.Collections.Specialized;
using AirWeb.DirectoryMgr;
using AirWeb.Support.Diagnostics;
using AirWeb.Support;
using AirWeb.ApplicationTools;

namespace FlashBack.Web
{
	/// <summary>
	/// Summary description for Welcome.
	/// </summary>
	public partial class Welcome : System.Web.UI.Page
	{

		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			NameValueCollection config = (NameValueCollection)
				ConfigurationSettings.GetConfig("flashBack/defaultUser");

			if(config != null)
			{
				string defAlbum = config["DefaultAlbum"];
				Response.Redirect("ThumbNails.aspx?path=" + defAlbum);
			}
			
			try
			{
				DirectoryHelper dh = new DirectoryHelper();
				string np = dh.GetNumPictures().ToString();
				string nf = dh.GetNumFolders().ToString();

				DateTime d = DirectoryHelper.GetLastModifiedTime(Server.MapPath(dh.CreateOriginalPath("\\")));
				LastModified.Text= "<br><br>" + np + " Pictures in " + nf + " albums" + "<br>Last modified on " + (d.ToLongDateString()) ;
				LastModified.Text += "<br>Version " + VersionManager.ApplcationVersion;
				LastModified.CssClass = "searchBody";
			}
			catch(Exception ex)
			{
				ApplicationLog.WriteTrace("Unable to get last update Date! Reason: " + ex.Message);
				throw ex;
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion
	}
}
